CKEDITOR.dialog.add( 'excelExport', function( editor ) {
    return { 
        title: 'Excel Export',
 
        minWidth: 400,
        minHeight: 500,
 
        contents :
                       [
                          {
                             id : 'iframe',
                             label : 'Embed Media',
                             expand : true,
                             elements :
                                   [
                                      {
                                       type : 'html',
                                       id : 'pageMediaEmbed',
                                       label : 'Embed Media'+this.path,
                                       style : 'width : 100%;height:500px',
                                       html : '<iframe src="/snapol/edit/ckeditor_plugins/dialogs/excelExport.php" frameborder="0" name="iframeMediaEmbed" id="iframeMediaEmbed" allowtransparency="1" style="width:100%;height:500px;margin:0;padding:0;"></iframe>'
                                      }
                                   ]
                          }
                       ],

 
 
         onOk: function() { 
            
           
            for (var i=0; i<window.frames.length; i++) {
                       if(window.frames[i].name == 'iframeMediaEmbed') {
                         // var content = window.frames[i].document.getElementById("embed").value;
                         frameId = i;
                       }
                    } 
              
             
              html = window.frames[frameId].document.getElementById('select').value; 
			  //html = "<p><a href=\"sqlexec?filename="+html+"\">sql exec</a></p>";
			  html = "<p><a href=\"exportExcel?filename="+html+"\">"+html+" (Excel Export)</a></p>";
				editor.insertHtml(html);      
            
            
            
         }
 

    };
 
} );
